using System;
using Microsoft.SPOT;
using MicroContainer;

namespace ConsoleDemo
{
   public class ComponentA1 : IComponentA
   {
      [Dependency(MappingName = "CompC")]
      public IComponentC CompC { get; set; }

      [Dependency(MappingName = "CompC2")]
      public IComponentC CompC2 { get; set; }

      public ComponentA1()
      {
         Debug.Print("ComponentA1: .ctor()");
      }

      public void DoSomething()
      {
         Debug.Print("ComponentA1: DoSomething()");
         if (CompC != null)
         {
            CompC.DoSomething();
         }
         if (CompC2 != null)
         {
            CompC2.DoSomething();
         }
      }
   }
   public class ComponentA2 : IComponentA
   {
      public IComponentC CompC { get; set; }

      public static ComponentA2 CreateComponentA2()
      {
         Debug.Print("ComponentA2: CreateComponentA2()");
         return new ComponentA2();
      }

      public ComponentA2()
      {
         Debug.Print("ComponentA2: .ctor()");
      }

      public void DoSomething()
      {
         Debug.Print("ComponentA2: DoSomething");
         if (CompC != null)
         {
            CompC.DoSomething();
         }
      }
   }
}
